#pragma once

#define g_globalAvailableMemory	(*(ui32 *)(0x00578E10))
#define g_pDirectDraw			(*(LPDIRECTDRAW *)(0x00578E04))
#define g_hWnd					(*(HWND *)(0x00579320))

#define g_screen_res_x			(*(i32 *)(0x0055B1A8))
#define g_screen_res_y			(*(i32 *)(0x0055B1AC))
#define g_screen_stride			(*(ui32 *)(0x0055B1B0))

#define	g_lpPrimarySurface			(*(LPDIRECTDRAWSURFACE *)(0x005792EC))
#define	g_lpBackBufferSurface		(*(LPDIRECTDRAWSURFACE *)(0x00578E18))

#define	g_lpSurface1			(*(LPDIRECTDRAWSURFACE *)(0x00578E58))
#define	g_lpSurface2			(*(LPDIRECTDRAWSURFACE *)(0x00579334))

#define g_pPalette					(*(LPDIRECTDRAWPALETTE *)(0x00578E64))
#define g_pGlobalPalette			(*(tagPALETTEENTRY *)(0x00578EE8))

#define g_error_status				(*(ui8 *)(0x00578E68))

#define dword_55B1B4				(*(ui32 *)(0x0055B1B4))

#define dword_578E20				(*(ui8 **)(0x00578E20))

#define byte_579350					(*(ui8 *)(0x00579350))

#define word_57931C					(*(ui16 *)(0x0057931C))

#define	FrameCount					(*(ui32 *)(0x0055B1B8))

#define ThreadHandle				(*(ui32 *)(0x0055B1BC))

#define global_QuitFlag				(*(ui8 *)(0x0055B1A4))

#define dword_579328				(*(ui32 *)(0x00579328))

#define bRenderBuffer				(*(ui8 *)(0x00578EDC))

#define word_578AC4					(*(i16 *)(0x00578AC4))
#define	dword_578B3C				(*(i32 *)(0x00578B3C))

#define g_pCursorSurface1		(*(LPDIRECTDRAWSURFACE *)(0x00578810))
#define g_pCursorSurface2		(*(LPDIRECTDRAWSURFACE *)(0x00578814))

#define MouseX						(*(ui16 *)(0x00578AA0))
#define MouseY						(*(ui16 *)(0x00578A9C))

#define cached_mouse_x				(*(ui16 *)(0x00578ABC))
#define cached_mouse_y				(*(ui16 *)(0x00578AB8))
//////////////////////////////////////////////////////////////////////////
HWND	CreateDirectDraw(DWORD videoMode);
void	FlipSurface();
int __stdcall	WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd);
HRESULT	UnlockAppropriateRenderBuffer();
void	UnlockPrimarySurface();
void	BlitToBackbuffer();
void	DrawCursorXY(i16 x, i16 y);
void	ForceCursorPos(i16 x, i16 y);
void	CreateCursorSurfaces();
void	DrawAutoCursor();
HRESULT	RestoreSurfaces();
void	CleanupSurfaces();
